from collections.abc import Iterator,Iterable,Generator

# 能够通过for循环去遍历的对象称为可迭代对象
li=[]
# print(isinstance(li,Iterable))


class MyList:
    """自定义可迭代对象"""
    def __iter__(self):
        return iter([11,12,13])


class MyList2:
    """自定义序列对象"""
    li=[11,12,13,14,15]
    def __getitem__(self, item):
        # print("item:",item)
        return self.li[item]


if __name__=="__main__":
    """自定义可迭代对象"""
    # m=MyList()
    # print(isinstance(m, Iterable))
    # for i in m:
    #     print(i)
    """自定义序列对象"""
    m2=MyList2()
    # print(m2[0])
    for i in m2:
        print(i)